﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TheLargestPrimeNumber
{
    /// <summary>
    /// 输出十万以内最大质数
    /// </summary>
    internal class Program
    {
        static void Main(string[] args)
        {
            int MaxPrimeNumber = 0;
            //从2到1万的循环
            for (int number = 2; number<10000;number++ )
            {
                bool isFind = true;
                //若与前面的数整除，则不是质数
                for (int PreviousNumber = number - 1; PreviousNumber > 2; PreviousNumber--)
                {
                    if (number % PreviousNumber == 0)
                    {
                        isFind = false;
                    }
                }
                if (isFind)
                 {
                        MaxPrimeNumber = number;
                  }
                
            }
            Console.Write(MaxPrimeNumber.ToString());
          
        }
    }
}
